﻿namespace CodeDDD.Application.Framework
{
    using System.Collections.Generic;

    /// <summary>
    /// Interface contract for a basic CRUD App Service
    /// </summary>
    /// <typeparam name="TDto"></typeparam>
    /// <typeparam name="TIdentity"></typeparam>
    public interface ICrudAppService<TDto, TIdentity> : ICrudAppService<TDto, TDto, TIdentity>
        where TDto : class, new()
    {
    }

    /// <summary>
    /// Interface contract for a basic CRUD App Service
    /// </summary>
    /// <typeparam name="TCommandDto"></typeparam>
    /// <typeparam name="TQueryDto"></typeparam>
    /// <typeparam name="TIdentity"></typeparam>
    public interface ICrudAppService<TCommandDto, TQueryDto, TIdentity> : IReadAppService<TQueryDto, TIdentity>, IWriteAppService<TCommandDto, TIdentity>
        where TCommandDto : class, new()
        where TQueryDto : class, new()
    {
    }

    public interface IReadAppService<TDto, TIdentity>
        where TDto : class, new()
    {
        IEnumerable<TDto> GetAll();
        TDto Get(TIdentity id);
    }

    public interface IWriteAppService<TDto, TIdentity>
        where TDto : class, new()
    {
        void Add(TDto item);
        void Update(TDto item);
        void Remove(TIdentity id);
    }
}
